package demo1;

public class Test2 {
    public static void main(String[] args) {
        try {
            int result = 10 / 0; // 这里会抛出ArithmeticException异常
            System.out.println("结果: " + result);
        } catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("捕获到算数异常");
        } finally {
            System.out.println("finally块中的代码一定会被执行");
        }
    }
}